package com.ruoyi.xixi.controller;

import com.ruoyi.common.annotation.Anonymous;
import com.ruoyi.xixi.domain.User;
import com.ruoyi.xixi.response.JsonResult;
import com.ruoyi.xixi.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
@Anonymous
//@RequestMapping("/system/dict/type")

public class CheckController {
    @Autowired private UserService userService;
//    @PreAuthorize("@ss.hasPermi('system:user:list')")
    @PostMapping("/user/getUserMessage")
    public JsonResult checkUserName(@RequestBody User user) throws Exception {
//       userService.getMessage(user.getMessage());
        Map<String, Object> responseData = new HashMap<>();
        responseData.put("message", userService.getMessage(user));
//        生成一个90-98的随机数
        int score = (int)(Math.random() * 9 + 90);
        responseData.put("score",score);
        return JsonResult.ok(responseData);
    }
}
